#include <iostream>
using namespace std;

template <class T>
class MyArray
{
public:
    MyArray(const MyArray &arr)
    {
        m_size = arr.m_size;
        m_maxSize = arr.m_maxSize;
        m_array = new T[m_maxSize];
        for (int i = 0; i < m_size; ++i)
        {
            m_array[i] = arr.m_array[i];
        }
    }

    MyArray(int maxSize)
    {

        m_maxSize = maxSize;
        m_array = new T[maxSize];
        m_size = 0;
    }

    ~MyArray()
    {
        if (m_array != NULL)
        {
            delete m_array;
        }
    }

    MyArray &operator=(const MyArray &arr)
    {
        if (m_array != NULL)
        {
            delete m_array;
        }
        m_size = arr.m_size;
        m_maxSize = arr.m_maxSize;
        m_array = new T[m_maxSize];
        for (int i = 0; i < m_size; ++i)
        {
            m_array[i] = arr.m_array[i];
        }

        return *this;
    }

    T &operator[](const int a)
    {
        return m_array[a];
    }

    MyArray &push(const T &data)
    {
        m_array[m_size] = data;
        m_size++;
        return *this;
    }

private:
    T *m_array;
    int m_size;
    int m_maxSize;
};

void test()
{
    MyArray<int> arr1(10);
    arr1.push(10);
    MyArray<int> arr3(100);
    arr3 = arr1;
    MyArray<int> arr2(arr1);
    for (int i = 0; i < 10; ++i)
    {
        cout << arr1[i] << " " << arr2[i] <<" "<<arr3[i]<< endl;
    }
}

int main()
{

    test();
}